<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
 * 公众号借用授权设置
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'display';
if($_RQ['op']=='display'){
	if($_RQ['postdata']){
		$post=get_postdata();
		$data=array_fields(array('open','wechat_id'),$post);
		core_setting('wechat_auth',$data);
		exi('设置成功！');
	}
	$item=core_setting('wechat_auth');
	if(!$item['wechat_id']){
		$item['wechat_id']=pdo_getcolumn('core_account_wechat',array('uniacid'=>$_SESSION['uniacid'],'isdefault'=>1),'id');
	}
	$return['item']=$item;
	$return['htmls']=array(
		'type'=>'edit',
		'edit'=>array(
			array('type'=>'switch','name'=>'open','title'=>'是否开启借用','help'=>'开启如果用户未绑定公众号或者公众号非认证服务号，且需要获取粉丝信息的。系统自动通过下面指定的公众号发起授权获取粉丝信息。'),
			array('type'=>'select','name'=>'wechat_id','title'=>'指定借用公众号','options'=>'wechats'),
		),
	);
	$return['wechats']=pdo_getall('core_account_wechat',array('uniacid'=>1,'type'=>4),array('id','title'));
	exi($return);
}